<template>
	
	<el-form ref="form" :model="form" label-width="80px">
		<el-form-item label="门店名称">
			<el-input v-model="form.storeName"></el-input>
		</el-form-item>
		<el-form-item label="员工姓名">
			<el-input v-model="form.name"></el-input>
		</el-form-item>
		<el-form-item label="职位">
			<el-input v-model="form.position"></el-input>
		</el-form-item>
		
		<el-form-item label="所属部门">
			<el-select v-model="form.deptId" placeholder="请选择">
			    <el-option
			      v-for="item in deptList"
			      :key="item.id"
			      :label="item.deptName"
			      :value="item.id">
			    </el-option>
			  </el-select>
		</el-form-item>
		
		<el-form-item label="邮箱">
			<el-input v-model="form.email"></el-input>
		</el-form-item>
		
		<el-form-item label="手机号">
			<el-input v-model="form.telphone"></el-input>
		</el-form-item>
	
		<el-form-item>
			<el-button type="primary" @click="onSubmit">完善信息</el-button>
			<el-button>取消</el-button>
			
			
		</el-form-item>
	</el-form>
</template>

<script>
	import axios from "axios"
	
	export default {
		data() {
			return {
				form: {
					storeName: '',
					position: '',
					name: '',
						deptId: '',
						email: '',
						telphone: ''
				},
				deptList:[]
			}
		},
		methods: {
			onSubmit() {
				console.log('submit!');
				axios.post('http://localhost:20010/api-store/api/user-store/updateUserStore', this.form).then(res => {
					if (res.data.code == 1) {
						this.$message({
							message: '恭喜你，完善成功',
							type: 'success'
						});
						
						
					}else{
						 this.$message.error(res.data.message);
					}
				})
			},
			reg(){
				this.$router.push({
					path:"/reg"
				})
			}
		},
		created() {
			//http://localhost:8172/api/user-store/findAllDept
			axios.get('http://localhost:20010/api-dept/api/dept/findAll').then(res=>{
				console.log(res)
				this.deptList=res.data
			})
		}
	}
	
</script>

<style>
</style>